﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using XDesigner.Writer.Dom;
using XDesigner.Writer.Security;

namespace XDesigner.Writer.Test
{
    public partial class dlgLogin : Form
    {
        public dlgLogin()
        {
            InitializeComponent();
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }

        private void dlgLogin_Load(object sender, EventArgs e)
        {
        }

        private UserLoginInfo _LoginInfo = null;

        public UserLoginInfo LoginInfo
        {
            get { return _LoginInfo; }
            set { _LoginInfo = value; }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            _LoginInfo = new UserLoginInfo();
            if (rdoZhang.Checked)
            {
                _LoginInfo.ID = "zhang";
                _LoginInfo.Name = "张主任";
                _LoginInfo.PermissionLevel = 2;
            }
            else if (rdoLi.Checked)
            {
                _LoginInfo.ID = "li";
                _LoginInfo.Name = "李医师";
                _LoginInfo.PermissionLevel = 1;
            }
            else if (rdoWang.Checked)
            {
                _LoginInfo.ID = "wang";
                _LoginInfo.Name = "王医师";
                _LoginInfo.PermissionLevel = 0;
            }
            else
            {
                MessageBox.Show("请选择一个登录身份");
                return;
            }
            _LoginInfo.Description = txtDescription.Text.Trim();
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
